const store = {
  state: {
    num: 10,
    name: "张三",
  },
  //同步调用
  action: {
    async add(state: { num: number }, val: number) {
      state.num += val;

      return state;
    },
    add1(state: { num: number }, val: number) {
      console.log("-=-=");
      return (state.num += val);
    },
  },
  //异步调用
  asyncAction: {
    asyncAdd(dis: Function) {
      setTimeout(() => {
        dis({ type: "add", val: 1 });
      }, 1000);
    },
  },
};

export default store;
